// 自定义节流函数：当多个事件在规定时间内多次触发，回调函数最终只会执行一次
export const throttle = function(fn, wait=200) {
  let start = 0
  return function(e) {
    let now = Date.now()
    if (now - start >= wait) {
      fn.call(this, e)
      start = now
    }
  }
}